package com.sss.hloster0103;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Scanner;

public class TestIP02 {

	public static void main(String[] args) {
		InetAddress bdIP = null;
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入要查询的IP地址域名：");
		String dName = sc.next();
		try {
			// 通过 InetAddress 类的静态方法，返回指定域名的IP地址对象
			bdIP = InetAddress.getByName(dName);
		} catch (UnknownHostException e) {
			e.printStackTrace();
		}
		System.out.println("域名为：：:" + dName + "  对应的IP地址为：" + bdIP.getHostAddress());

	}

}
